﻿using System;
using System.Windows;
using Csla.Xaml;
using Accounting.Library;

namespace csla4Skeleton.UI.SL.NghiepVu.NganHang.NH_GiayNo
{
    public partial class NH_GiayNo_ListViewModel : ViewModel<NH_GiayNoList>
    {

        public NH_GiayNo_ListViewModel(string mode)
        {
            BeginRefresh("GetNH_GiayNoList", mode);

        }

        public void GetNH_GiayNo_ListViewModel(string mode)
        {
            BeginRefresh("GetNH_GiayNoList", mode);
        }

        public static readonly DependencyProperty SelectedItemProperty =
          DependencyProperty.Register("SelectedItem", typeof(NH_GiayNoInfo), typeof(NH_GiayNo_ListViewModel), null);
        public NH_GiayNoInfo SelectedItem
        {
            get { return (NH_GiayNoInfo)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        public void DeleteNH_GiayNo(object sender, ExecuteEventArgs e)
        {
            if (e.MethodParameter != null)
            {
                //cast OrderID parameter
                int Khoa = Int16.Parse(e.MethodParameter.ToString());
                this.IsBusy = true;
                Accounting.Library.NH_GiayNo.DeleteNH_GiayNo(Khoa, (o, ex) =>
                {
                    BeginRefresh("GetNH_GiayNoList",BusinessConfiguration.Configuration.GridViewFetchMode);
                });
                this.IsBusy = false;
            }
        }	
    }
}
